package com.jinjie.config;

import com.jinjie.config.web.IllegalRequestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author JinJie
 */
@Configuration
public class SystemConfig {

    @Bean
    public FilterRegistrationBean<IllegalRequestFilter> contextPathFilter() {
        FilterRegistrationBean<IllegalRequestFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new IllegalRequestFilter());
        registrationBean.addUrlPatterns("/**"); // 拦截所有请求
        return registrationBean;
    }

}
